<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>


<html:html>
<head>
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/stkissue2.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/stkissue/stkissue.css" />	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/sampleForm.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/me.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/help/help.css" />
<script type="text/javascript" >
function returnToMainForm(lineNumber, itemOffset) {
	
	var	docNo	= 	document.getElementById("docNo"+itemOffset).innerHTML;
			
	opener.document.getElementById("docNo"+lineNumber).value = docNo;							
			
	window.close(); 
}
function colorOver() {
	
}
</script>

<style>

.odd{background-color :#fFA700; }
.even{background-color:#fFA700; }

.menu-over{background-color:#64b1ff;}

</style>

<script type="text/javascript" >

function modalWinItem(aa) {
	if (window.showModalDialog) {		
		window.showModalDialog(aa,"name","dialogTop:100px;dialogWidth:450px;dialogHeight:350px;center:yes");
	} else {		
		window.open(aa,'name','height=350,width=100,toolbar=no,directories=no,status=no,continued from previous linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
	}
}
</script>
	
</head>

<body onload="document.getElementById('itemFind').focus();"><br />
<div id="wrapper">
	<!-- 
		<div id="header"><img src="images/kiuchilogo.png" width="305" height="80" /></div>
	 -->	 
	<div id="menu"><ul id="nav"></ul></div>
	  
	<div id="content">
		<div id="menuNav">			
			<a href="<%=request.getContextPath() %>/Login.do?mode=check" >หน้าหลัก</a> 
			
		</div>		<br />

					
		<div >	
		<div>			
			<html:form action="/stock.do?mode=pack">
				ค้นหา รหัส/ชื่อ:<html:text property="itemFind" value="${itemFind}" styleId="itemFind" />
				แสดงผลต่อหน้า:<html:select property="maxEntriesPerPage" value="${maxEntriesPerPage}">
							<html:option value="20">20 รายการ</html:option>							
							<html:option value="50">50 รายการ</html:option>
							<html:option value="100">100 รายการ</html:option>
							<html:option value="1000">1000 รายการ</html:option>
						  </html:select>
				<html:submit value="ค้นหา" />
			</html:form>						
		</div>
		<div>
		<table border="1" width="90%">
			<tr><td colspan="4"  >ค้นหา&nbsp;<font color="red"><b>${itemFind}</b></font>  พบ  ${allElement } ระเบียน</td>
				<td colspan="4"   align="right">หน้า ${currentPage }/${lastPage }</td>
			</tr>
			<tr><td colspan="8">
					<logic:empty name="firstPage">หน้าแรก</logic:empty>
					<logic:notEmpty name="firstPage">			
						<html:link action="/stock.do?mode=pack&page=${FirstPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >หน้าแรก</html:link>
					</logic:notEmpty>
					<logic:empty name="previousPage">ถอยหลัง</logic:empty>
					<logic:notEmpty name="previousPage">
						<html:link action="/stock.do?mode=pack&page=${previousPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >ถอยหลัง</html:link>					
					</logic:notEmpty>										
					<logic:empty name="nextPage">ถัดไป</logic:empty>
					<logic:notEmpty name="nextPage">						
						<html:link action="/stock.do?mode=pack&page=${nextPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >ถัดไป</html:link>
					</logic:notEmpty>										
					<logic:empty name="lastPage">หน้าสุดท้าย</logic:empty>
					<logic:notEmpty name="lastPage">
						<html:link action="/stock.do?mode=pack&page=${lastPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >หน้าสุดท้าย</html:link>
					</logic:notEmpty>
											
				</td>
			</tr>
			<tr class="odd">
				<td width="20">No.</td>
				<td width="200">รหัส</td>
				<td width="300">ชื่อ</td>
				<td width="100">รหัสภายใน</td>
				<td width="200">ชื่อภายใน</td>
				<td width="70">Pack</td>
				<td width="70">Min</td>
				<td width="70">Max</td>				
			</tr>
			
			<logic:notEmpty name="itemResults">
				<logic:iterate id="var" name="itemResults" indexId="id">

						<tr onmouseover="this.className='menu-over'" 
							onmouseout="this.className='even'" class="even">
							<td width="20">${id+1+offset }.</td>																		
							<td width="200">
								<html:link action="/stock.do?mode=viewpack&itemFind=${var.itemCode }">${var.itemCode }</html:link>
							</td>					
							<td width="300">${var.itemName }</td>
							<td width="100">${var.barcode }</td>
							<td width="200">${var.barcodeName }</td>
							<td width="70" align="right">&nbsp;
								<c:if test="${var.packSize!=0 }">${var.packSize }</c:if>								 
							</td>
							<td width="70"><c:if test="${var.stockMin!=0 }">${var.stockMin }</c:if></td>
							<td width="70"><c:if test="${var.stockMax!=0 }">${var.stockMax }</c:if></td>						
						</tr>
				</logic:iterate> 
			</logic:notEmpty>
		</table>
		</div>
</div>
</div>
</body>

</html:html>